package net.huashitong.Project.web;

import com.sirdc.modules.core.filter.Paging;
import com.sirdc.modules.core.web.JsonBaseController;
import com.sirdc.modules.core.web.model.Message;
import net.huashitong.Project.entity.EarlyWarningNode;
import net.huashitong.Project.service.EarlyWarningNodeService;
import net.huashitong.user.entity.BnpUser;
import net.huashitong.user.filter.BnpUserFilter;
import net.huashitong.user.service.BnpUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * app获取预警信息Controller
 */
@Controller
@RequestMapping("/app/earlyWarningNode/")
public class EarlyWarningNodeController extends JsonBaseController {
    @Autowired
    private EarlyWarningNodeService ewns;
    @Autowired
    private BnpUserService bus;
    @Override
    protected String getView(String s) {
        return null;
    }
    @ResponseBody
    @RequestMapping("/queryEarlyWarningNode")
    public Message queryEarlyWarningNode(@RequestBody BnpUserFilter filter){
       /* Paging p=new Paging();
        if (filter.getCurrentPage() == null){
            filter.setPage(0);
        }
        p.setCurrentPage(Integer.parseInt(filter.getCurrentPage()));
        filter.setPaging(p);
        BnpUser bu=  bus.getById(filter.getSysid());

        if("2".equals(bu.getBranchType())){
             list=ewns.query();
        }else{
            filter.setName(bu.getName());
            filter.setPhone(bu.getPhone());
             list=ewns.queryEarlyWarningNodeListByUserId(filter);
        }*/
        List<EarlyWarningNode> list=ewns.queryEarlyWarningNodeList();
        return coverMessage("200", "获取成功",list);
    }

}
